package rubik;

public enum EMove {
	LCW (EFace.LEFT,false),
	RCW (EFace.RIGHT, false),
	UCW (EFace.UP, false),
	DCW (EFace.DOWN, false),
	FCW (EFace.FRONT, false),
	BCW (EFace.BACK, false),
	LCCW (EFace.LEFT, true),
	RCCW (EFace.RIGHT, true),
	UCCW (EFace.UP, true),
	DCCW (EFace.DOWN, true),
	FCCW (EFace.FRONT, true),
	BCCW (EFace.LEFT, true);
	
	private EFace _eface;
	private boolean _ccw;
 
	
	private EMove(EFace eface, boolean ccw)
	{
		this._eface = eface;
		this._ccw = ccw;
	}
	
	public EMove inverse()
	{
		return  EMove.values()[(this.ordinal()+6) % 12];
	}
	
	public EFace getFace()
	{
		return this._eface;
	}
	
	public boolean isCCW()
	{
		return this._ccw;
	}
	
	public static EMove getByValues(EFace eface, boolean ccw)
	{
		for (EMove emove: EMove.values())
		{
			if (emove.getFace() == eface && emove.isCCW() == ccw)
			{
				return emove;
			}
		}
		return null;
	}
	
	public String toString()
	{
		switch (this) {
		case LCW: return "L";
		case RCW: return "R";
		case UCW: return "U";
		case DCW: return "D";
		case FCW: return "F";
		case BCW: return "B";
		case LCCW: return "L'";
		case RCCW: return "R'";
		case UCCW: return "U'";
		case DCCW: return "D'";
		case FCCW: return "F'";
		case BCCW: return "B'";
		default: return "";
		}
	}
}

